#define _CRT_SECURE_NO_WARNINGS 1
#include "tree.h"

BTNode* BuyNode(char val)
{
	BTNode* node = (BTNode*)malloc(sizeof(BTNode));
	if (node == NULL)
	{
		perror("malloc");
		return 1;
	}
	node->x = val;
	node->left = node->right = NULL;
}

BTNode* BuyBinaryTree()
{
	BTNode* nodeA = BuyNode('A');
	BTNode* nodeB = BuyNode('B');
	BTNode* nodeC = BuyNode('C');
	BTNode* nodeD = BuyNode('D');
	BTNode* nodeE = BuyNode('E');
	BTNode* nodeF = BuyNode('F');

	nodeA->left = nodeB;
	nodeA->right = nodeC;
	nodeB->left = nodeD;
	nodeC->left = nodeE;
	nodeC->right = nodeF;

	return nodeA;
}

void test01()
{
	BTNode* root = BuyBinaryTree();
	//preOrder(root);
	inOrder(root);
}

int main()
{
	test01();
	return 0;
}